package com.bestbuy.serviceimple;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bestbuy.dao.AccountDao;
import com.bestbuy.pojo.Account;
import com.bestbuy.pojo.AccountInfo;
import com.bestbuy.pojo.AccountRole;
import com.bestbuy.service.AccountService;

@Service
public class AccountServiceImpl implements AccountService
{
	@Autowired
	private AccountDao accountDAO;
	
	@Transactional
	public Account RegisterAccount(String username, String password) 
	{
		return accountDAO.RegisterAccount(username, password);
	}

	@Transactional
	public Account Authenticate(String username, String password) {
		// TODO Auto-generated method stub
		return accountDAO.Authenticate(username, password);
	}
	
	
	
	/* (non-Javadoc)
	 * @see com.bestbuy.service.AccountService#RegisterAccountWithFacebook(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
	 */
	@Transactional
	public Account RegisterAccountWithFacebook(String username,
			String fullname, String gender, String linkFacebook) {
		// TODO Auto-generated method stub
		return accountDAO.RegisterAccountWithFacebook(username, fullname, gender, linkFacebook);
	}

	/* (non-Javadoc)
	 * @see com.bestbuy.service.AccountService#GetAccountInfo(java.lang.String)
	 */
	@Transactional
	public AccountInfo GetAccountInfo(String username) {
		// TODO Auto-generated method stub
		return accountDAO.GetAccoutInfo(username);
	}

	@Transactional
	public Account GetAccount(String username)
	{
		return accountDAO.GetAccount(username);
	}

	@Transactional
	public void updateAccount(Account account) {
		// TODO Auto-generated method stub
		accountDAO.updateAccount(account);
	}

	@Transactional
	public void deleteAccount(Account account) {
		// TODO Auto-generated method stub
		accountDAO.deleteAccount(account);
	}
	
	
	
	/* (non-Javadoc)
	 * @see com.bestbuy.service.AccountService#UpdateAccountInfo(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
	 */
	@Transactional
	public Account UpdateAccountInfo(String username, String fullname,
			String sex, String birthday, String address, String email,
			String phone) {
		return accountDAO.UpdateAccountInfo(username, fullname, sex, birthday, address, email, phone);
	}

	/* (non-Javadoc)
	 * @see com.bestbuy.service.AccountService#getListAccount()
	 */
	@Transactional
	public List<Account> getListAccount() {
		// TODO Auto-generated method stub
		return accountDAO.getListAccount();
	}

	/* (non-Javadoc)
	 * @see com.bestbuy.service.AccountService#getRoleAccount(com.bestbuy.pojo.Account)
	 */
	@Transactional
	public AccountRole getRoleAccount(String role) {
		// TODO Auto-generated method stub
		return accountDAO.getRoleAccount(role);
	}
	

}
